<template>
  <div>
    <el-dialog
      title="完善项目信息"
      @close="closeDialog"
      :visible.sync="projectInfoVisible"
      :close-on-click-modal="false"
      width="994px"
      :modal-append-to-body="false"
      :close-on-press-escape="false"
      :show-close="false"
      class="doubleColumnsDialog"
    >
      <!-- <div slot="title" class="header-title">
                <el-row class="topBox">
                    <div class="fl title">完善项目信息：</div>
                    <div class="fl">
                        <el-select
                            v-model="projectId"
                            value-key="projectId"
                            filterable
                            placeholder="暂无关联项目"
                        >
                            <el-option
                                v-for="(item, index) of projectList"
                                :key="index"
                                :label="item.projectName"
                                :value="item.projectId"
                                :title="item.projectName"
                                @click.native="
                                    changeProject(
                                        item.projectId,
                                        item.projectName
                                    )
                                "
                            ></el-option>
                        </el-select>
                    </div>
                    <div class="fl statusBox">
                        <span
                            :class="[
                                startStatus,
                                {
                                    greenBack: statusDesc === '已开工',
                                    StartOver: statusDesc === '已竣工',
                                    startStop: statusDesc === '已停工',
                                    noStart: statusDesc === '未开工',
                                },
                            ]"
                            >{{ statusDesc }}</span
                        >
                    </div>
                </el-row>
                <el-row>
                    <p class="desc">为方便您使用系统，请完善项目信息</p>
                </el-row>
            </div> -->
      <div style="margin-bottom: 20px">
        <div class="contentTop clearfix">
          <p class="fl">
            <span class="topProjectName" id="topProjectName">{{
              projectName
            }}</span>
            <!-- </p>
                    <p class="fl statusBox"> -->
            <span
              :class="[
                startStatus,
                {
                  greenBack: statusDesc === '已开工',
                  startOver: statusDesc === '已竣工',
                  startStop: statusDesc === '已停工',
                  noStart: statusDesc === '未开工',
                },
              ]"
              >{{ statusDesc }}</span
            >
          </p>
        </div>
      </div>
      <div>
        <el-form
          :model="formData"
          :rules="formRules"
          ref="formData"
          label-width="167px"
          class="demo-ruleForm"
        >
          <el-row>
            <el-col>
              <div class="secondaryTitle secondaryTitleTheme mrB20">
                项目基本信息
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <div class="grid-content bg-purple">
                <el-row>
                  <el-col :span="12">
                    <el-form-item prop="projectName" label="项目名称：">
                      <el-input
                        v-model.trim="formData.projectName"
                        placeholder="请输入项目名称"
                        class="proInputWidth"
                        @blur="validProName"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="areaId" label="所属区域：">
                      <el-cascader
                        v-model="areaId"
                        :options="areasOptions"
                        @change="getAreaId"
                        clearable
                        filterable
                        placeholder="请选择"
                        class="proInputWidth"
                      ></el-cascader>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item prop="industryId" label="所属行业：">
                      <el-select
                        clearable
                        filterable
                        placeholder="请选择"
                        class="proInputWidth"
                        v-model="formData.industryId"
                      >
                        <el-option
                          v-for="item in industryId"
                          :key="item.code"
                          :label="item.name"
                          :value="item.code"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="investment" label="投资类别：">
                      <el-select
                        clearable
                        filterable
                        placeholder="请选择"
                        class="proInputWidth"
                        v-model="formData.investment"
                      >
                        <el-option
                          v-for="item in investmentOptions"
                          :key="item.id"
                          :label="item.name"
                          :value="item.id"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item prop="projectCost" label="工程造价：">
                      <el-input
                        v-model.trim="formData.projectCost"
                        placeholder="请输入金额，单位为：元"
                        class="proInputWidth doubleColumnsHalfInp"
                        clearable
                      ></el-input>
                      元
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="startDate" label="开工日期：">
                      <el-date-picker
                        type="date"
                        placeholder="请选择"
                        v-model="formData.startDate"
                        class="proInputWidth"
                        clearable
                        value-format="yyyy-MM-dd"
                      ></el-date-picker>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item prop="constructionCycle" label="建设周期：">
                      <el-input
                        v-model.trim="formData.constructionCycle"
                        placeholder="请输入时长，单位为：天"
                        class="proInputWidth doubleColumnsHalfInp"
                        clearable
                      ></el-input>
                      天
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      prop="detailAddress"
                      label="详细地址："
                      :rules="
                        isNeedAddress == 0
                          ? [{ required: false }]
                          : formRules.detailAddress
                      "
                    >
                      <div style="position: relative">
                        <el-input
                          v-model.trim="formData.detailAddress"
                          maxlength="200"
                          placeholder="请输入详细地址"
                          class="proInputWidth"
                          id="suggestId"
                          @blur="hideMap"
                          ref="inputDetailAdr"
                        ></el-input>
                        <div
                          style="
                            width: 62%;
                            height: 33px;
                            background: #fff;
                            position: absolute;
                            top: 3px;
                            left: 3px;
                            z-index: 10;
                            opacity: 0;
                          "
                          @click="showMap"
                          v-if="isShowBox"
                        ></div>
                        <div
                          id="searchResultPanel"
                          style="
                            border: 1px solid #c0c0c0;
                            width: 150px;
                            height: auto;
                            display: none;
                          "
                        ></div>
                      </div>
                      <el-row class="row-padding-bottom" v-if="isShowMap">
                        <el-col :span="24" class="col-position">
                          <div
                            id="l-map"
                            style="
                              height: 300px;
                              position: absolute;
                              width: 70%;
                              z-index: 1000;
                            "
                          ></div>
                        </el-col>
                      </el-row>

                      <!-- 获取当前地址  -->
                      <div id="allmap"></div>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item prop="typeId" label="工程类型：">
                      <el-select
                        clearable
                        filterable
                        placeholder="请选择"
                        class="proInputWidth"
                        v-model="formData.typeId"
                      >
                        <el-option
                          v-for="item in typeId"
                          :key="item.code"
                          :label="item.name"
                          :value="item.code"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12" v-if="isWhUser()">
                    <el-form-item
                      prop="isStateOwnedConstruction"
                      label="是否国企施工项目："
                      :rules="
                        isNeedIsStateOwned == 0
                          ? [{ required: false }]
                          : formRules.isStateOwnedConstruction
                      "
                    >
                      <el-select
                        clearable
                        filterable
                        placeholder="请选择项目的施工总承包企业是否属于国有企业"
                        class="proInputWidth"
                        v-model="formData.isStateOwnedConstruction"
                      >
                        <el-option label="是" value="1"></el-option>
                        <el-option label="否" value="0"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="projectStatus" label="项目状态：">
                      <el-select
                        clearable
                        filterable
                        placeholder="请选择"
                        class="proInputWidth"
                        v-model.trim="formData.projectStatus"
                        :disabled="isDisabled"
                      >
                        <el-option
                          v-for="item in statusOptions"
                          :key="item.id"
                          :label="item.name"
                          :value="item.id"
                          :disabled="item.disabled"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <!-- </el-row>
                                <el-row> -->
                  <el-col :span="12">
                    <el-form-item
                      prop="license"
                      label="施工许可证："
                      :rules="
                        isNeedLicense == 1
                          ? {
                              required: true,
                              message: '施工许可证不能为空',
                              trigger: 'blur ',
                            }
                          : { required: false, trigger: 'blur' }
                      "
                    >
                      <el-input
                        v-model.trim="formData.license"
                        placeholder="请输入施工许可证号"
                        class="proInputWidth"
                        @blur="validProName"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12" v-if="isXiangYangUser()">
                    <el-form-item
                      label="合同签订日："
                      prop="contractSignDate"
                      :rules="
                        isNeedContractSignDate == 0
                          ? [{ required: false }]
                          : formRules.contractSignDate
                      "
                    >
                      <el-date-picker
                        type="date"
                        placeholder="请选择"
                        v-model="formData.contractSignDate"
                        value-format="yyyy-MM-dd"
                        class="proInputWidth"
                        clearable
                      ></el-date-picker>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      prop="constructLocation"
                      label="施工地址："
                      :rules="
                        isNeedConstructLocation == 0
                          ? [{ required: false }]
                          : formRules.constructLocation
                      "
                    >
                      <el-input
                        v-model.trim="formData.constructLocation"
                        placeholder="请输入施工详细地址"
                        class="proInputWidth"
                        clearable
                        @blur="formData.constructLocation = changeValue($event)"
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="24">
                    <el-form-item
                      label="开工令："
                      class="upLoadDomContainer"
                      :rules="
                        isNeedOrdFiles == 0
                          ? [{ required: false }]
                          : formRules.upLoadFileOrder
                      "
                      prop="upLoadFileOrder"
                    >
                      <uploadAnnex
                        @getFileList="getFileListOrder"
                        :limitationFactor="limitationFactorOrder"
                        @getFile="getFileOrder"
                      />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="24">
                    <uploadResult
                      style="margin-left: 167px !important"
                      :resultList="upLoadFileOrder"
                      @callBackResult="getFileOrder"
                    />
                  </el-col>
                </el-row>
              </div>
            </el-col>
          </el-row>
          <div class="halfLine"></div>
          <el-row>
            <el-col>
              <div class="secondaryTitle secondaryTitleTheme mrB20">
                建设方信息
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <div class="grid-content bg-purple">
                <el-row>
                  <el-col :span="12">
                    <el-form-item prop="pcName" label="单位名称：">
                      <!--                                        <el-input v-model.trim="formData.pcName" placeholder="请输入项目全权负责人姓名" class="proInputWidth" clearable></el-input>-->
                      <span>{{ formData.pcName }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="pcUscc" label="统一社会信用代码：">
                      <!--                                        <el-input v-model.trim="formData.pcUscc" placeholder="请输入项目全权负责人手机号码" class="proInputWidth" clearable></el-input>-->
                      <span>{{ formData.pcUscc }}</span>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item
                      label="项目负责人："
                      prop="pcLeader"
                      :rules="
                        isNeedPcLeader == 0
                          ? [{ required: false }]
                          : formRules.pcLeader
                      "
                    >
                      <el-input
                        v-model.trim="formData.pcLeader"
                        placeholder="请输入项目负责人姓名"
                        class="proInputWidth"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      label="负责人手机号："
                      prop="pcLeaderTel"
                      :rules="
                        isNeedPcLeaderTel == 0
                          ? [{ required: false }]
                          : formRules.pcLeaderTel
                      "
                    >
                      <el-input
                        v-model.trim="formData.pcLeaderTel"
                        placeholder="请输入项目负责人手机号"
                        class="proInputWidth"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
              </div>
            </el-col>
          </el-row>
          <div class="halfLine"></div>
          <el-row>
            <el-col>
              <div class="secondaryTitle secondaryTitleTheme mrB20">
                施工方信息
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <div class="grid-content bg-purple">
                <el-row>
                  <el-col :span="12">
                    <el-form-item prop="pbName" label="单位名称：">
                      <!--                                        <el-input v-model.trim="formData.pbName" placeholder="请输入项目全权负责人姓名" class="proInputWidth" clearable></el-input>-->
                      <span>{{ formData.pbName }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="pbUscc" label="统一社会信用代码：">
                      <!--                                        <el-input v-model.trim="formData.pbUscc" placeholder="请输入项目全权负责人手机号码" class="proInputWidth" clearable></el-input>-->
                      <span>{{ formData.pbUscc }}</span>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item
                      prop="leader"
                      label="项目负责人："
                      :rules="
                        isNeedLeader == 0
                          ? [{ required: false }]
                          : formRules.leader
                      "
                    >
                      <el-input
                        v-model.trim="formData.leader"
                        placeholder="请输入项目负责人姓名"
                        class="proInputWidth"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      prop="leaderTel"
                      label="负责人手机号："
                      :rules="
                        isNeedLeaderTel == 0
                          ? [{ required: false }]
                          : formRules.leaderTel
                      "
                    >
                      <el-input
                        v-model.trim="formData.leaderTel"
                        placeholder="请输入项目负责人手机号"
                        class="proInputWidth"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
              </div>
            </el-col>
          </el-row>
          <div class="halfLine"></div>
          <el-row>
            <el-col>
              <div class="secondaryTitle secondaryTitleTheme mrB20">
                项目经理信息
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <div class="grid-content bg-purple">
                <el-row>
                  <el-col :span="12">
                    <el-form-item
                      prop="managerName"
                      label="项目经理姓名："
                      :rules="
                        isNeedManagerName == 1
                          ? formRules.managerName
                          : { required: false, trigger: 'blur' }
                      "
                    >
                      <el-input
                        v-model.trim="formData.managerName"
                        placeholder="请输入项目经理姓名"
                        class="proInputWidth"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      prop="managerIdcard"
                      label="项目经理身份证号："
                      :rules="
                        isNeedManagerIdcard == 0
                          ? [
                              {
                                required: false,
                                pattern:
                                  /^(([1-9][0-9]{5}(19|20)[0-9]{2}((0[1-9])|(1[0-2]))([0-2][1-9]|10|20|30|31)[0-9]{3}([0-9]|X|x))|([1-9][0-9]{5}[0-9]{2}((0[1-9])|(1[0-2]))([0-2][1-9]|10|20|30|31)[0-9]{3}))$/,
                                message: '请输入正确的身份证号',
                                trigger: 'blur',
                              },
                            ]
                          : formRules.managerIdcard
                      "
                    >
                      <el-input
                        v-model.trim="formData.managerIdcard"
                        placeholder="请输入项目经理身份证号"
                        class="proInputWidth"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item
                      prop="managerTel"
                      label="项目经理手机号："
                      :rules="
                        isNeedManagerTel == 0
                          ? [
                              {
                                required: false,
                                pattern: /^1[3456789]\d{9}$/,
                                message: '请输入正确的手机号码',
                                trigger: 'blur',
                              },
                            ]
                          : formRules.managerTel
                      "
                    >
                      <el-input
                        v-model.trim="formData.managerTel"
                        placeholder="请输入项目经理手机号"
                        class="proInputWidth"
                        clearable
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="24">
                    <el-form-item
                      label="项目经理资格证书："
                      prop="managerUpLoadFile"
                      :rules="
                        isNeedMgFiles == 0
                          ? [{ required: false }]
                          : formRules.managerUpLoadFile
                      "
                    >
                      <uploadAnnex
                        @getFileList="getFileListManager"
                        :limitationFactor="limitationFactorManager"
                        @getFile="getFileManager"
                        :upLoadFile="managerUpLoadFile"
                      />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="24" v-model="formData.managerImgUrl">
                    <!-- <elementImage
                                            :upLoadFile="managerUpLoadFile"
                                            :srcList="managerSrcList"
                                            :oldSrcList="managerOldSrcList"
                                            @changeSrcList="changeSrcList"
                                        ></elementImage> -->
                    <uploadResult
                      style="margin-left: 167px !important"
                      :resultList="managerUpLoadFile"
                      @callBackResult="changeSrcList"
                    />
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="24">
                    <el-form-item
                      label="项目经理企业任命文件："
                      prop="manUploadFiles"
                      :rules="
                        isAppointJson == 0
                          ? [{ required: false }]
                          : formRules.manUploadFiles
                      "
                    >
                      <uploadAnnex
                        @getFileList="getFileListManFiles"
                        :limitationFactor="limitationFactorManFiles"
                        @getFile="getFileManFiles"
                        :upLoadFile="manUploadFiles"
                      />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="24">
                    <uploadResult
                      style="margin-left: 167px !important"
                      :resultList="manUploadFiles"
                      @callBackResult="getFileManFiles"
                    />
                  </el-col>
                </el-row>
              </div>
            </el-col>
          </el-row>
          <div class="halfLine"></div>
          <el-row>
            <el-col>
              <div class="secondaryTitle secondaryTitleTheme mrB20">
                合同信息
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <div class="grid-content bg-purple">
                <el-row>
                  <el-col :span="24">
                    <el-form-item
                      label="合同附件："
                      :rules="
                        isNeedUpLoadFile == 0
                          ? [{ required: false }]
                          : formRules.upLoadFile
                      "
                      prop="upLoadFile"
                    >
                      <uploadAnnex
                        @getFileList="getFileList"
                        :limitationFactor="limitationFactor"
                        @getFile="getFile"
                        :upLoadFile="upLoadFile"
                      />
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="24">
                    <!-- <elementImage
                                            :upLoadFile="upLoadFile"
                                            :srcList="srcList"
                                            :oldSrcList="oldSrcList"
                                            @changeSrcList="changeList"
                                        ></elementImage> -->
                    <uploadResult
                      style="margin-left: 167px !important"
                      :resultList="upLoadFile"
                      @callBackResult="changeList"
                    />
                  </el-col>
                </el-row>
              </div>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer">
        <!-- <el-button class="cancle" @click="closeDialog">取消</el-button> -->
        <el-button
          class="save"
          type="primary"
          @click="saveToDetail"
          :loading="isSaveLoading"
          >保存</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import common from '../../kits/common'
import { mapActions, mapState } from 'vuex'
// import project from "../../router/project";
export default {
  name: 'projectInfoUpd',
  components: {},
  props: {
    projectId: {
      type: String,
      default: '',
    },
  },
  data() {
    // 验证工程造价
    var checkMoney = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('工程造价不能为空'))
      } else {
        var reProjectCost =
          /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/
        if (!reProjectCost.test(value) || value == 0.0 || value == 0.0) {
          callback(new Error('工程造价格式不正确,必须大于0,最多带有2位小数'))
        } else {
          if (value >= 100000000000) {
            callback(new Error('工程造价需小于1000亿'))
          } else {
            callback()
          }
        }
      }
    }
    // 验证建设周期
    var validateConCycle = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('建设周期不能为空'))
      } else {
        var ConCycle = /^\+?[1-9]\d*$/
        if (!ConCycle.test(value)) {
          callback(new Error('建设周期必须是正整数'))
        } else {
          if (value >= 36500) {
            callback(new Error('建设周期不能大于36500天'))
          } else {
            callback()
          }
        }
      }
    }
    var checkArea = (rule, value, callback) => {
      // console.log(this.areaId);
      if (!this.areaId || this.areaId.length < 1) {
        return callback(new Error('所属区域不能为空'))
      } else {
        callback()
      }
    }
    var validAddress = (rule, value, callback) => {
      var that = this
      var address
      if (that.formData.detailAddress) {
        address = that.formData.detailAddress.replace(/\s/g, '')
      } else {
        address = ''
      }
      setTimeout(function () {
        if (!that.lat || !address) {
          return callback(new Error('请输入有效地址'))
        } else {
          callback()
        }
      }, 500)
    }
    //验证企业名称
    var validateName = (rule, value, callback) => {
      value = value.replace(/\s+/g, '')
      if (value === '') {
        callback(new Error('企业名称不能为空'))
      } else {
        if (value.length > 100) {
          callback(new Error('企业名称不能超过100个字符'))
        } else {
          if (this.formData.jsUscc !== '') {
            this.$refs.formData.validateField('jsUscc')
          }

          callback()
        }
      }
    }
    //验证uscc
    var validateUscc = (rule, value, callback) => {
      value = value.replace(/\s+/g, '')
      if (value === '') {
        callback(new Error('统一社会信用代码不能为空'))
      } else {
        var regUscc = /^[0-9A-Z]{2}[0-9]{6}[0-9A-Z]{10}$/
        if (!regUscc.test(value)) {
          callback(new Error('统一社会信用代码格式不正确'))
        } else {
          var companyName = this.formData.unitName
          if (this.jsFlag == '') {
            this.validUscc(companyName, value, callback)
          } else {
            if (
              (this.jsName != companyName ||
                this.jsUscc != value ||
                this.jsFlag == '2') &&
              this.saveFlag == '1'
            ) {
              this.validUscc(companyName, value, callback)
            } else {
              callback()
            }
          }
        }
      }
    }
    var validateManagerUpLoadFile = (rele, value, callback) => {
      if (this.managerUpLoadFile.length < 1) {
        return callback(new Error('必须上传项目经理资格证书'))
      } else {
        callback()
      }
    }
    // 武汉施工许可证
    var checkUpLoadFileLicense = (rule, value, callback) => {
      if (this.upLoadFileLicense.length == 0) {
        return callback(new Error('请上传施工许可证'))
      } else {
        callback()
      }
    }
    // 合同附件
    var checkUpLoadFile = (rule, value, callback) => {
      if (this.upLoadFile.length == 0) {
        return callback(new Error('请上传合同附件'))
      } else {
        callback()
      }
    }
    var validateManUploadFiles = (rule, value, callback) => {
      if (this.manUploadFiles.length == 0) {
        return callback(new Error('请上传项目经理企业任命文件'))
      } else {
        callback()
      }
    }

    var validateConAddress = (rule, value, callback) => {
      if (value) {
        value = value.toString().replace(/\s+/g, '')
      }
      if (value === '') {
        callback(new Error('请输入施工地址'))
      } else {
        if (value.length > 50) {
          callback(new Error('施工地址最多可输入50字'))
        } else {
          callback()
        }
      }
    }

    var checkUpLoadFileOrder = (rule, value, callback) => {
      if (this.upLoadFileOrder.length == 0) {
        return callback(new Error('请上传开工令附件'))
      } else {
        callback()
      }
    }
    return {
      projectInfoVisible: true,
      formData: {
        projectStatus: '',
        industryId: '',
        investment: '',
        projectCost: '',
        startDate: '',
        constructionCycle: '',
        typeId: '',
        detailAddress: '',
        areaId: '',
        leader: '',
        leaderTel: '',
        pcName: '',
        pcUscc: '',
        pbName: '',
        pbUscc: '',
        pcLeader: '',
        pcLeaderTel: '',
        managerIdcard: '',
        managerName: '',
        managerTel: '',
        projectName: '',
        license: '', // 施工许可证
        isStateOwnedConstruction: '',
        contractSignDate: '',
        constructLocation: '',
      },
      formRules: {
        isStateOwnedConstruction: [
          {
            required: true,
            message: '请选择项目的施工总承包企业是否属于国有企业',
            trigger: 'change',
          },
        ],
        projectStatus: [
          {
            required: true,
            message: '项目状态不能为空',
            trigger: 'change',
          },
        ],
        areaId: [
          {
            required: true,
            validator: checkArea,
            // message: "所属区域不能为空",
            trigger: 'change',
          },
        ],
        industryId: [
          {
            required: true,
            message: '所属行业不能为空',
            trigger: 'change',
          },
        ],
        investment: [
          {
            required: true,
            message: '投资类别不能为空',
            trigger: 'change',
          },
        ],
        projectCost: [
          {
            required: true,
            validator: checkMoney,
            trigger: 'blur',
          },
        ],
        startDate: [
          {
            required: true,
            message: '开工日期不能为空',
            trigger: 'change',
          },
        ],
        constructionCycle: [
          {
            required: true,
            validator: validateConCycle,
            trigger: 'blur',
          },
        ],
        typeId: [
          {
            required: true,
            message: '工程类型不能为空',
            trigger: 'change',
          },
        ],
        detailAddress: [
          {
            required: true,
            validator: validAddress,
            trigger: 'change',
          },
        ],
        leader: [
          {
            required: true,
            message: '项目全权负责人姓名不能为空',
            trigger: 'blur',
          },
        ],
        leaderTel: [
          {
            required: true,
            pattern: /^1[3456789]\d{9}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur',
          },
        ],
        pcName: [
          {
            required: true,
            validator: validateName,
            trigger: 'change',
          },
        ],
        pcUscc: [
          {
            required: true,
            validator: validateUscc,
            trigger: 'change',
          },
        ],
        pbName: [
          {
            required: true,
            validator: validateName,
            trigger: 'change',
          },
        ],
        pbUscc: [
          {
            required: true,
            validator: validateUscc,
            trigger: 'change',
          },
        ],
        managerName: [
          {
            required: true,
            message: '项目全权负责人姓名不能为空',
            trigger: 'blur',
          },
        ],
        managerIdcard: [
          {
            required: true,
            pattern:
              /^(([1-9][0-9]{5}(19|20)[0-9]{2}((0[1-9])|(1[0-2]))([0-2][1-9]|10|20|30|31)[0-9]{3}([0-9]|X|x))|([1-9][0-9]{5}[0-9]{2}((0[1-9])|(1[0-2]))([0-2][1-9]|10|20|30|31)[0-9]{3}))$/,
            message: '请输入正确的身份证号',
            trigger: 'blur',
          },
        ],
        managerTel: [
          {
            required: true,
            pattern: /^1[3456789]\d{9}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur',
          },
        ],
        projectName: [
          {
            required: true,
            message: '项目名称不能为空',
            trigger: 'blur',
          },
        ],
        upLoadFileLicense: [
          {
            required: true,
            validator: checkUpLoadFileLicense,
            trigger: 'blur',
          },
        ],
        upLoadFile: [
          {
            required: true,
            validator: checkUpLoadFile,
            trigger: 'blur',
          },
        ],
        manUploadFiles: [
          {
            required: true,
            validator: validateManUploadFiles,
            trigger: 'change',
          },
        ],
        constructLocation: [
          { required: true, validator: validateConAddress, trigger: 'blur' },
        ],
        pcLeader: [
          { required: true, message: '请输入项目负责人', trigger: 'blur' },
        ],
        pcLeaderTel: [
          { required: true, message: '请输入负责人手机号码', trigger: 'blur' },
        ],
        upLoadFileOrder: [
          {
            required: true,
            validator: checkUpLoadFileOrder,
            trigger: 'blur',
          },
        ],
      },
      isShowMap: false, //是否显示地图
      lon: '',
      lat: '',
      LocationPoint: '',
      isShowBox: true,
      selectData: '',
      typeId: [], //工程类型
      investment: [], //投资类别
      industryId: [], //所属行业
      startStatus: 'startStatus', //状态样式
      statusDesc: '已开工',
      status: '',
      areaId: [],
      projectData: '',
      // projectId: "",
      isSaveLoading: false, // 保存loading
      upLoadFile: [], //附件
      srcList: [],
      oldSrcList: [],
      managerUpLoadFile: [], //项目经理资质附件
      managerSrcList: [],
      managerOldSrcList: [],
      isDisabled: false,
      // 项目经理资格证书
      limitationFactorManager: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传文件最大数量设置
        fileSize: 5, //自定义上传文件最大设置
        messagetip: '仅支持上传png、jpg、jpeg格式文件', //自定义报错提示语
        formatType: 'typeOne', //自定义上传格式校验类型
        fileId: 'managerFiles', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'managerFilesForm', //自定义id解决一个页面包含多个上传附件
        methodTip:
          '请上传项目项目经理资质证书，最多上传5张照片，要求图片格式为jpg、png，最大不超过5M', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      // 合同信息
      limitationFactor: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传文件最大数量设置
        fileSize: 5, //自定义上传文件最大设置
        messagetip: '仅支持上传png、jpg、jpeg格式文件', //自定义报错提示语
        formatType: 'typeOne', //自定义上传格式校验类型
        fileId: 'salaryExcel', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'salaryExcelForm', //自定义id解决一个页面包含多个上传附件
        methodTip:
          '请上传项目合同第一页以及末页（需包含项目基础信息以及合同盖章内容）即可，最多上传5张图片，要求图片格式为jpg、png，最大不超过5M', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      // 任命书
      limitationFactorManFiles: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'manUploadFiles', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'manFilesForm', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip:
          '请上传项目经理任命书，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      projectName: '',
      statusOptions: [],
      list: [],
      isNeedLicense: '', //施工许可证
      isNeedUpLoadFile: '', //合同附件
      isNeedManagerName: '', //项目经理姓名
      isNeedManagerIdcard: '', //项目经理身份证号
      isNeedManagerTel: '', //项目经理手机号码
      isNeedMgFiles: '', //项目经理资格证书
      isNeedIsStateOwned: '', //是否国企施工项目
      isAppointJson: '',
      isNeedContractSignDate: '', //合同签订日
      manFilesOldSrcList: [], //任命书
      manFilesSrcList: [],
      manUploadFiles: [],
      isNeedAddress: '', //详细地址
      isNeedConstructLocation: '', //施工地址
      isNeedPcLeader: '', //建设方负责人
      isNeedPcLeaderTel: '', //建设方负责人手机号
      isNeedLeader: '',
      isNeedLeaderTel: '',
      upLoadFileOrder: [], //开工令附件
      srcListOrder: [],
      oldSrcListOrder: [],
      isNeedOrdFiles: '', //开工令附件
      // 开工令
      limitationFactorOrder: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'startOrder', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'startOrderForm', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip:
          '请上传开工令，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
    }
  },
  async created() {
    await this.getIsNeed() //是否必填
    // this.projectId = this.$route.query.projectId;
    this.getSelecData('INDUSTRY') //所属行业
    this.getSelecData('PROJECT_INVESTMENT') //投资类别
    this.getSelecData('PROJECT_TYPE') //工程类型
    //修改开工状态新接口
    this.getStatus()
    this.getAreas({ areaId: this.$store.state.areaInfoArr.areaId })
    //初始化信息
    this.getData()
  },
  computed: {
    ...mapState(['areasOptions', 'investmentOptions']),
  },
  mounted() {
    this.$nextTick(function () {
      this.getLocation()
    })
  },
  methods: {
    ...mapActions(['getAreas']),
    closeDialog() {
      this.$emit('closeDialog')
    },
    getStatus() {
      this.axios({
        method: 'post',
        url: '/api-p/projectstats/expand/monitorstatus',
      })
        .then((response) => {
          this.statusOptions = response.data.result
        })
        .catch((response) => {})
    },
    saveToDetail() {
      this.$refs.formData.validate((valid) => {
        if (valid) {
          // 保存更新
          this.isSaveLoading = true
          this.submitFormUptate()
        } else {
          return false
        }
      })
    },
    submitFormUptate() {
      var data = {
        id: this.projectId,
        lon: this.lon,
        lat: this.lat,
        projectName: this.formData.projectName,
        industryId: this.formData.industryId,
        total: this.formData.projectCost,
        investment: this.formData.investment,
        startDate: this.formData.startDate,
        salaryDay: this.formData.salaryDay,
        cycle: this.formData.constructionCycle,
        address: this.formData.detailAddress,
        status: this.formData.projectStatus,
        typeId: this.formData.typeId,
        areaId: this.formData.areaId,
        leader: this.formData.leader,
        leaderTel: this.formData.leaderTel, //---项目负责人电话
        files: JSON.stringify(this.upLoadFile), //---项目合同附件
        pcName: this.formData.pcName, //建设方单位名称
        pcUscc: this.formData.pcUscc, //建设方统一社会信用代码
        pbName: this.formData.pbName, //施工方单位名称
        pbUscc: this.formData.pbUscc, //施工方统一社会信用代码\
        managerName: this.formData.managerName,
        managerIdcard: this.formData.managerIdcard,
        managerTel: this.formData.managerTel,
        pcLeader: this.formData.pcLeader, //---建设方项目负责人
        pcLeaderTel: this.formData.pcLeaderTel, //---建设方项目负责人电话
        mgFiles: JSON.stringify(this.managerUpLoadFile), //项目经理资格证书
        license: this.formData.license,
        isStateOwnedConstruction: this.formData.isStateOwnedConstruction,
        contractSignDate: this.formData.contractSignDate,
        appointJson: JSON.stringify(this.manUploadFiles),
        constructLocation: this.formData.constructLocation,
        ordFiles: JSON.stringify(this.upLoadFileOrder), //开工令
      }
      this.axios({
        method: 'post',
        url: 'api-p/project/expand/editProject',
        data: data,
      })
        .then((response) => {
          this.isSaveLoading = false
          if (!response.data.hasError) {
            this.$message({
              message: '保存成功',
              type: 'success',
            })
            this.closeDialog()
            // setTimeout(() => {
            //     // this.$emit('isShow','save')
            //     this.$router.push({
            //         path:
            //             "/home/monitorProjectManagement/projectDetail",
            //         name: "projectDetail",
            //         query: {
            //             projectId: this.projectId,
            //         },
            //     });
            //     this.$store.commit("CHANGE_SLIDER_NAME", {
            //         oldUrl: "/home/project/projectList",
            //         newUrl: this.$router.currentRoute.fullPath,
            //     });
            // }, 1500);
          } else {
            this.$message({
              type: 'error',
              message: response.data.errorMsg,
            })
            this.isSaveLoading = false
          }
        })
        .catch((error) => {
          this.$message.error('保存失败')
          this.isSaveLoading = false
        })
    },
    // 获取页面数据
    getData() {
      this.axios({
        method: 'post',
        url: 'api-p/project/expand/initdata',
        data: { id: this.projectId },
      })
        .then((resp) => {
          if (!resp.data.hasError) {
            this.projectData = resp.data.result
            this.lon = this.projectData.lon
            this.lat = this.projectData.lat
            this.projectName = this.projectData.projectName
            this.formData.projectName = this.projectData.projectName
            this.formData.startDate = this.projectData.startDate
            this.formData.constructionCycle = this.projectData.cycle
            if (
              this.projectData.status == 'STOPPED' ||
              this.projectData.status == 'FINISHED' ||
              this.projectData.status == 'COMPLETED'
            ) {
              this.isDisabled = true
            } else {
              this.isDisabled = false
            }
            this.formData.projectStatus = this.projectData.status
            this.statusDesc = this.projectData.statusDesc
            this.status = this.projectData.status
            this.formData.industryId = this.projectData.industryId
            this.formData.investment = this.projectData.investment
            this.formData.projectCost = this.projectData.total
            this.formData.startDate = this.projectData.startDate
            this.formData.constructionCycle = this.projectData.cycle
            this.formData.typeId = this.projectData.typeId
            this.formData.detailAddress = this.projectData.address
            // this.areaId = [this.projectData.provinceId,this.projectData.cityId,this.projectData.countyId];
            this.areaId = this.projectData.areaList
            this.formData.areaId = this.projectData.areaId
            this.upLoadFile = this.projectData.contractFiles
            this.formData.leader = this.projectData.leader //---项目负责人
            this.formData.leaderTel = this.projectData.leaderTel //---项目负责人电话
            this.formData.pcName = this.projectData.pcName
            this.formData.pcUscc = this.projectData.pcUscc
            this.formData.pbName = this.projectData.pbName
            this.formData.pbUscc = this.projectData.pbUscc
            this.formData.pcLeader = this.projectData.pcLeader
            this.formData.pcLeaderTel = this.projectData.pcLeaderTel
            this.managerUpLoadFile = this.projectData.manFiles
            this.formData.managerIdcard = this.projectData.managerIdcard
            this.formData.managerName = this.projectData.managerName
            this.formData.managerTel = this.projectData.managerTel
            this.formData.license = this.projectData.license
            this.formData.contractSignDate = this.projectData.contractSignDate
            this.manUploadFiles = this.projectData.appointFiles

            if (this.upLoadFile.length > 0) {
              for (var i = 0; i < this.upLoadFile.length; i++) {
                this.srcList.push(this.upLoadFile[i].url)
                this.oldSrcList.push(this.upLoadFile[i].url)
              }
            }
            if (this.managerUpLoadFile.length > 0) {
              for (var i = 0; i < this.managerUpLoadFile.length; i++) {
                this.managerSrcList.push(this.managerUpLoadFile[i].url)
                this.managerOldSrcList.push(this.managerUpLoadFile[i].url)
              }
            }
            if (this.manUploadFiles.length > 0) {
              for (var i = 0; i < this.manUploadFiles.length; i++) {
                this.manFilesSrcList.push(this.manUploadFiles[i].url)
                this.manFilesOldSrcList.push(this.manUploadFiles[i].url)
              }
            }
            this.formData.isStateOwnedConstruction = this.projectData
              .isStateOwnedConstruction
              ? this.projectData.isStateOwnedConstruction
              : ''
            if (!this.isWhUser()) {
              delete this.formRules.isStateOwnedConstruction
            }
            this.formData.constructLocation = this.projectData.constructLocation
            this.upLoadFileOrder = this.projectData.orFiles //开工令
            if (this.upLoadFileOrder.length > 0) {
              for (var i = 0; i < this.upLoadFileOrder.length; i++) {
                this.srcListOrder.push(this.upLoadFileOrder[i].url)
                this.oldSrcListOrder.push(this.upLoadFileOrder[i].url)
              }
            }
            // this.$nextTick(() => {
            //     this.$refs.formData.clearValidate();
            // });
          }
        })
        .catch((resp) => {
          this.$message.error('数据获取失败')
        })
    },
    //获取选中的区域最后一级id
    getAreaId() {
      this.formData.areaId = this.areaId[this.areaId.length - 1]
    },
    getLocation() {
      var that = this
      var map = new BMap.Map('allmap')

      function myFun(result) {
        var cityName = result.name
        map.setCenter(cityName)
        that.LocationPoint = cityName
      }
      var myCity = new BMap.LocalCity()
      myCity.get(myFun)
    },
    showMap() {
      this.isShowMap = true
      this.isShowBox = false
      var addressName = this.formData.detailAddress
      this.$nextTick(function () {
        // 详细地址获取焦点
        this.$refs.inputDetailAdr.focus()
        this.initMap()
        setTimeout(function () {
          if ($('.tangram-suggestion-main').length == 1) {
            $('#suggestId').val(addressName)
          }
        }, 50)
        $('#suggestId').val(addressName)
      })
    },
    hideMap() {
      var that = this
      setTimeout(function () {
        if (that.selectData == '1') {
          that.isShowMap = true
          that.selectData = ''
          that.isShowBox = false
        } else {
          that.isShowMap = false
          that.isShowBox = true
        }
      }, 500)
    },
    initMap() {
      var that = this
      // 百度地图API功能
      function G(id) {
        return document.getElementById(id)
      }

      var map = new BMap.Map('l-map')
      if (that.formData.detailAddress) {
        that.isShowMap = true
        this.isShowBox = false

        var point = new BMap.Point(that.lon, that.lat)

        map.centerAndZoom(point, 16)

        var mk = new BMap.Marker(point)
        map.addOverlay(mk)
        map.panTo(point)
      } else {
        var myGeo = new BMap.Geocoder()
        // 将地址解析结果显示在地图上,并调整地图视野
        myGeo.getPoint(
          that.LocationPoint,
          function (point) {
            if (point) {
              map.centerAndZoom(point, 16)

              var mk = new BMap.Marker(point)

              map.addOverlay(mk)
              map.panTo(point)
            } else {
              // alert("您选择地址没有解析到结果!");
            }
          },
          '北京市'
        )
      }
      //增加滚轮放大缩小
      map.enableScrollWheelZoom(true)

      //增加滚轮放大缩小
      var ac = new BMap.Autocomplete({
        //建立一个自动完成的对象
        input: 'suggestId',
        location: map,
      })

      ac.addEventListener('onhighlight', function (e) {
        // that.selectData = "1";
        //鼠标放在下拉列表上的事件
        var str = ''
        var _value = e.fromitem.value
        var value = ''
        if (e.fromitem.index > -1) {
          value =
            _value.province +
            _value.city +
            _value.district +
            _value.street +
            _value.business
        }
        str =
          'FromItem<br />index = ' + e.fromitem.index + '<br />value = ' + value

        value = ''
        if (e.toitem.index > -1) {
          _value = e.toitem.value
          value =
            _value.province +
            _value.city +
            _value.district +
            _value.street +
            _value.business
        }
        str +=
          '<br />ToItem<br />index = ' +
          e.toitem.index +
          '<br />value = ' +
          value
        G('searchResultPanel').innerHTML = str
      })

      var myValue
      ac.addEventListener('onconfirm', function (e) {
        that.selectData = '1'
        //鼠标点击下拉列表后的事件
        var _value = e.item.value
        myValue =
          _value.province +
          _value.city +
          _value.district +
          _value.street +
          _value.business
        G('searchResultPanel').innerHTML =
          'onconfirm<br />index = ' +
          e.item.index +
          '<br />myValue = ' +
          myValue
        that.formData.detailAddress = myValue
        setPlace()
      })

      function setPlace() {
        map.clearOverlays() //清除地图上所有覆盖物
        function myFun() {
          var pp = local.getResults().getPoi(0).point //获取第一个智能搜索的结果
          map.centerAndZoom(pp, 18)
          var marker = new BMap.Marker(pp)
          map.addOverlay(marker) //添加标注
          that.lon = pp.lng
          that.lat = pp.lat
          var geoc = new BMap.Geocoder()
        }
        var local = new BMap.LocalSearch(map, {
          //智能搜索
          onSearchComplete: myFun,
        })
        local.search(myValue)
      }
    },
    getSelecData(type) {
      var url
      if (type == 'PROJECT_INVESTMENT' || type == 'PROJECT_STATUS') {
        url = 'api-p/project/expand/findstatusbytype'
      } else {
        url = 'api-bs/base/dicitem/findbytype'
      }
      this.axios({
        method: 'post',
        url: url,
        data: { type: type },
      })
        .then((res) => {
          if (type == 'INDUSTRY') {
            this.industryId = res.data.result
          } else if (type == 'PROJECT_TYPE') {
            this.typeId = res.data.result
          } else if (type == 'PROJECT_INVESTMENT') {
            this.investment = res.data.result
          }
          // else if (type == "PROJECT_STATUS") {
          //     this.projectStatus = res.data.result;
          // }
        })
        .catch((error) => {
          this.$message({
            showClose: true,
            duration: 3000,
            message: '获取数据失败',
            type: 'error',
          })
        })
    },

    /**
     * @description: 改变图片地址
     */
    changeList(val) {
      this.srcList = val
    },
    /**
     * @description: 改变图片地址
     */
    changeSrcList(val) {
      this.managerSrcList = val
    },
    getFileListManager(val) {
      this.managerOldSrcList.push(val)
      this.managerSrcList.push(val)
    },
    getFileManager(val) {
      this.managerUpLoadFile = val
    },
    getFileList(val) {
      this.oldSrcList.push(val)
      this.srcList.push(val)
    },
    getFile(val) {
      this.upLoadFile = val
    },
    validProName() {
      if (this.formData.projectName) {
        this.axios({
          method: 'post',
          url: 'api-p/project/expand/validatename',
          data: {
            name: this.formData.projectName,
            id: this.projectId,
          },
        })
          .then((resp) => {
            if (resp.data.hasError) {
              this.$message({
                showClose: true,
                duration: 3000,
                message: resp.data.errorMsg,
                type: 'error',
              })
            }
          })
          .catch((resp) => {
            console.log('请求失败')
          })
      }
    },
    // 项目经理任命书
    getFileListManFiles(val) {
      this.manFilesOldSrcList.push(val)
      this.manFilesSrcList.push(val)
    },
    getFileManFiles(val) {
      this.manUploadFiles = val
    },
    getIsNeed() {
      return this.axios({
        method: 'post',
        url: 'api-m/fieldconfig/base/getbymaintype',
        data: {
          mainType: 'PROJECT_BUILD',
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.list = response.data.result
            // this.$set(this.listObject,'isNeedManagerTel',element.isNeed)
            this.list.forEach((element) => {
              if (element.code == 'license') {
                //施工许可证
                this.isNeedLicense = element.isNeed
              } else if (element.code == 'isStateOwnedConstruction') {
                //是否国企施工项目
                this.isNeedIsStateOwned = element.isNeed
              } else if (element.code == 'contractSignDate') {
                //合同签订日
                this.isNeedContractSignDate = element.isNeed
              } else if (element.code == 'files') {
                //合同附件
                this.isNeedUpLoadFile = element.isNeed
              } else if (element.code == 'managerName') {
                //项目经理姓名
                this.isNeedManagerName = element.isNeed
              } else if (element.code == 'managerIdcard') {
                //项目经理身份证号managerIdcard
                this.isNeedManagerIdcard = element.isNeed
              } else if (element.code == 'managerTel') {
                //项目经理手机号码
                this.isNeedManagerTel = element.isNeed
              } else if (element.code == 'mgFiles') {
                //项目经理资格证书
                this.isNeedMgFiles = element.isNeed
              } else if (element.code == 'appointJson') {
                //项目经理任命文件
                this.isAppointJson = element.isNeed
              } else if (element.code == 'address') {
                this.isNeedAddress = element.isNeed
              } else if (element.code == 'constructLocation') {
                this.isNeedConstructLocation = element.isNeed
              } else if (element.code == 'pcLeader') {
                this.isNeedPcLeader = element.isNeed
              } else if (element.code == 'pcLeaderTel') {
                this.isNeedPcLeaderTel = element.isNeed
              } else if (element.code == 'leader') {
                this.isNeedLeader = element.isNeed
              } else if (element.code == 'leaderTel') {
                this.isNeedLeaderTel = element.isNeed
              } else if (element.code == 'ordFiles') {
                //开工令附件
                this.isNeedOrdFiles = element.isNeed
              }
            })
          } else {
            this.$message.error(response.data.errorMsg)
          }
        })
        .catch((error) => {
          if (error.response) {
            this.$message.error(error.response.data)
          }
        })
    },
    // 开工令
    getFileListOrder(val) {
      this.oldSrcListOrder.push(val)
      this.srcListOrder.push(val)
    },
    getFileOrder(val) {
      this.upLoadFileOrder = val
    },
  },
  watch: {
    'formData.detailAddress': {
      handler(newVal, oldVal) {
        if (oldVal) {
          if (newVal != oldVal) {
            // this.lon = "";
            // this.lat = ""
          }
        }
      },
      deep: true,
    },
  },
}
</script>

<style lang="less" scoped>
.statusBox {
  margin-top: 8px;
}
.topProjectName {
  font: bold 18px Microsoft YaHei;
  color: #333;
  margin-bottom: 6px;
  line-height: 26px;
}
/* 开工状态 */
// .startStatus {
//     padding: 2px 8px;
//     color: #fff;
//     font-size: 12px;
//     margin-left: 10px;
//     vertical-align: top;
// }
.greenBack {
  background: #009588;
}
// .StartOver {
//     background: #657282;
// }
// .noStart {
//     background: #ffc100;
// }
// .startStop {
//     background: #d9544f;
// }
.infoTitle {
  font-size: 16px;
  padding: 16px 24px;
  background: #f5f7fb;
  margin-bottom: 24px;
  color: #333;
  font-weight: 700;
}
// .proInputWidth {
//     width: 80%;
// }
.uploadBox {
  position: relative;
  .uploadImg {
    width: 96px;
    height: 36px;
    color: #009588;
    border: 1px solid #009588;
    line-height: 10px;
  }
  .uploadImgState {
    font-size: 14px;
    color: #999999;
    margin-left: 12px;
  }
  .upLoadDom {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    input {
      width: 100px;
      height: 36px;
      cursor: pointer;
    }
  }
}
.imgStyle {
  padding-left: 100px;
  margin-bottom: 24px;
  li {
    position: relative;
    margin-right: 20px;
    margin-top: 10px;
    i {
      position: absolute;
      right: -6px;
      top: -10px;
      font-size: 20px;
    }
  }
}
.title {
  font: bold 20px Microsoft YaHei;
  color: #333333;
  line-height: 30px;
}
/deep/.el-dialog__footer {
  padding: 7px 20px;
  text-align: right;
}
.save {
  width: 110px !important;
  height: 36px !important;
}
.mrB20 {
  margin-bottom: 20px;
}
.halfLine {
  width: 100%;
  position: relative;
  margin-bottom: 20px;
  &::after {
    position: absolute;
    left: 0;
    right: 0;
    content: '';
    height: 1px;
    width: 100%;
    transform: scaleY(0.5);
    background-color: #e3e7e9;
  }
}
</style>
